import request from '@/config/axios'

// 农场到自营门店配送订单商品明细 VO
export interface DeliveryOrderItemVO {
  id: number // 主键ID
  orderId: number // 配送订单ID
  productId: number // 配送商品ID
  quantity: number // 配送数量
  totalPrice: number // 小计金额
  qualityRemark: string // 质量备注
}

// 农场到自营门店配送订单商品明细 API
export const DeliveryOrderItemApi = {
  // 查询农场到自营门店配送订单商品明细分页
  getDeliveryOrderItemPage: async (params: any) => {
    return await request.get({ url: `/trade/delivery-order-item/page`, params })
  },

  // 查询农场到自营门店配送订单商品明细详情
  getDeliveryOrderItem: async (id: number) => {
    return await request.get({ url: `/trade/delivery-order-item/get?id=` + id })
  },

  // 新增农场到自营门店配送订单商品明细
  createDeliveryOrderItem: async (data: DeliveryOrderItemVO) => {
    return await request.post({ url: `/trade/delivery-order-item/create`, data })
  },

  // 修改农场到自营门店配送订单商品明细
  updateDeliveryOrderItem: async (data: DeliveryOrderItemVO) => {
    return await request.put({ url: `/trade/delivery-order-item/update`, data })
  },

  // 删除农场到自营门店配送订单商品明细
  deleteDeliveryOrderItem: async (id: number) => {
    return await request.delete({ url: `/trade/delivery-order-item/delete?id=` + id })
  },

  // 导出农场到自营门店配送订单商品明细 Excel
  exportDeliveryOrderItem: async (params) => {
    return await request.download({ url: `/trade/delivery-order-item/export-excel`, params })
  }
}
